package com.niit.order.web;


import com.niit.order.pojo.Order;
import com.niit.order.service.IOrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author yaojianfeng
 */
@RestController
@RequestMapping("order")
public class OrderController {

   @Resource
   private IOrderService orderService;
   @Resource
   private IOrderService orderServiceCenter;



    @GetMapping("{orderId}")
    public Order queryOrderByUserId(@PathVariable("orderId") Long orderId) {
        // 根据id查询订单并返回
        return orderService.queryOrderById(orderId);
    }


    @GetMapping("/center/{orderId}")
    public Order queryOrderByUserIdFromCenter(@PathVariable("orderId") Long orderId) {
        // 根据id查询订单并返回
        return orderServiceCenter.queryOrderById(orderId);
    }
}
